//
//  ShakeOpenView.m
//  PropertyMananger
//
//  Created by bh on 17/3/7.
//  Copyright © 2017年 BH. All rights reserved.
//

#import "ShakeOpenView.h"

@implementation ShakeOpenView

- (instancetype)initWithFrame:(CGRect)frame{

    self = [super initWithFrame:frame];
    
    if (self) {
        
        UIImageView *  bgView = [[UIImageView alloc]init];
        [self addSubview:bgView];
        
        
        
        bgView.image = IMG(@"bg_shake");
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.equalTo(self).with.offset(0);
        make.size.mas_equalTo(CGSizeMake(BHscreenW, BHscreenH - 44));
    }];
        
        self.backgroundColor = Theme_Color;
        
//        self.backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
//        [self addSubview:self.backBtn];
//        
//        [self.backBtn setImage:[UIImage imageNamed:@"ico_return"] forState:UIControlStateNormal];
//        
//        [self.backBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.leading.equalTo(self).with.offset(15);
//            make.top.equalTo(self).with.offset(44);
//            make.size.mas_equalTo(CGSizeMake(20, 20));
//        }];

        
        self.tipLabel = [[UILabel alloc]init];
        [self addSubview:self.tipLabel];
        
        self.tipLabel.text = @"温馨提示:此功能需要打开蓝牙\n并距离五米之内";
        self.tipLabel.textColor = [UIColor whiteColor];
        self.tipLabel.font = BHFont(15);
        self.tipLabel.textAlignment = NSTextAlignmentCenter;
        
        self.tipLabel.numberOfLines = 2;
        
        [self.tipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self).with.offset(0);
            make.top.equalTo(self).with.offset(70);
            make.size.mas_equalTo(CGSizeMake(BHscreenW - 100, 70));
        }];
        
        
        self.shakeImg = [[UIImageView alloc]init];
        [self addSubview:self.shakeImg];
        self.shakeImg.userInteractionEnabled = YES;
        self.shakeImg.image = IMG(@"ico_yaoyiyao_1");
        
        [self.shakeImg mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self).with.offset(0);
            make.centerY.equalTo(self).with.offset(-20);
            make.size.mas_equalTo(CGSizeMake(130, 100));
        }];
        
        self.imageView = [[UIImageView alloc]init];
        [self addSubview:self.imageView];
        self.imageView.userInteractionEnabled = YES;
     
        [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self).with.offset(0);
            make.centerY.equalTo(self).with.offset(-20);
            make.size.mas_equalTo(CGSizeMake(130, 100));
        }];

        
        
        [self.shakeImg mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self).with.offset(0);
            make.centerY.equalTo(self).with.offset(-20);
            make.size.mas_equalTo(CGSizeMake(130, 100));
        }];

        
        
        self.myKeyButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [self addSubview:self.myKeyButton];
        [self.myKeyButton setTitle:@"我的钥匙包>>" forState:UIControlStateNormal];
        
        [self.myKeyButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        self.myKeyButton.titleLabel.font = BHFont(15);
        
        [self.myKeyButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self).with.offset(0);
            make.bottom.equalTo(self).with.offset(-164);
            make.size.mas_equalTo(CGSizeMake(BHscreenW/2, 25));
        }];
        
    }
    return self;
}

@end
